#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);


    QIcon icon("c:/windowPicture/th.jpg");
    ui->pushButton_5->setIcon(icon);
    ui->pushButton_5->setIconSize(QSize(50,50));

    ui->pushButton->setShortcut(QKeySequence("A"));
    ui->pushButton_2->setShortcut(QKeySequence("W"));
    ui->pushButton_3->setShortcut(QKeySequence("D"));
    ui->pushButton_4->setShortcut(QKeySequence("S"));

    ui->pushButton->setAutoRepeat(1);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    QRect rect = ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(rect.x() - 5, rect.y(), rect.width(), rect.height());
}

void Widget::on_pushButton_4_clicked()
{
    QRect rect = ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(rect.x(), rect.y() + 5, rect.width(), rect.height());
}

void Widget::on_pushButton_2_clicked()
{
    QRect rect = ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(rect.x(), rect.y() - 5, rect.width(), rect.height());
}

void Widget::on_pushButton_3_clicked()
{
    QRect rect = ui->pushButton_5->geometry();
    ui->pushButton_5->setGeometry(rect.x() + 5, rect.y(), rect.width(), rect.height());
}
